package jpavlich.cardsorter.action;

import java.awt.geom.Point2D;
import java.io.Serializable;

import fr.inria.zvtm.engine.Location;

public class SerializableLocation extends Location implements Serializable {

	private double x;
	private double y;
	private double a;

	public SerializableLocation() {
		this(0,0,0);
	}
	
	public SerializableLocation(Location loc) {
		this(loc.getX(), loc.getY(), loc.getAltitude());
	}
	
	public SerializableLocation(double x, double y, double a) {
		super(x, y, a);
		this.x = x;
		this.y = y;
		this.a = a;
	}

	public void setPosition(Point2D.Double p) {
		vx = p.x;
		vy = p.y;
		x = p.x;
		y = p.y;
	}

	/** Set x-coordinate only. */
	public void setPositionX(double x) {
		vx = x;
		this.x = x;
	}

	/** Set y-coordinate only. */
	public void setPositionY(double y) {
		vy = y;
		this. y = y;
	}

	public void setAltitude(double a) {
		alt = a;
		this.a = a;
	}

	public Point2D.Double getPosition() {
		return new Point2D.Double(x, y);
	}

	public double getX() {
		return x;
	}

	public double getY() {
		return y;
	}

	public double getAltitude() {
		return a;
	}

	public String toString() {
		return "x=" + x + ", y=" + y + ", a=" + a;
	}

}
